<template>
  <div v-if="books">
    <van-row class="goods-item" @click="goDetail()" :lid="books.book_id">
      <van-col span="7">
        <div class="item-cover">
          <img width="90" height="120" :src="books.cover" alt="" />
        </div>
      </van-col>
      <van-col span="17">
        <div class="top">
          <!-- {{ books }} -->
          <h4 class="goods-title">{{ books.book_name }}</h4>
          <p class="goods-des">{{ books.title }}</p>
        </div>
        <div class="bottom" style="margin-top: 26px">
          <span>{{ books.publisher }}</span>
          <div class="bottom-right">
            <span style="color: gary; margin-right: 5px"
              >￥{{ books.price }}</span
            >
            <span v-if="books.free == 1" style="color: orange">会员免费</span>
          </div>
        </div>
      </van-col>
    </van-row>
  </div>
</template>

<script>
export default {
  // 设置books属性, 接受所有的参数
  props: ['books'],
  data() {
    return {}
  },
  methods: {
    // bookList() {
    //   this.$router.push('/bookdetail')
    // },
    // 跳转详情页
    goDetail() {
      let lid = this.books.book_id
      // console.log("book_id:",this.books.book_id)
      this.$router.push('bookdetail/' + lid)
    },
  },
 
}
</script>

<style lang="scss" scoped>
* {
  margin: 0;
  padding: 0;
}
.goods-item {
  margin-bottom: 10px;
}
.item-cover {
  position: relative;
  width: 90px;
  height: 120px;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid #ebebeb;
}
.top {
  width: 100%;
  align-self: flex-start;
}
.goods-des {
  height: 44px;
  font-size: 14px;
  color: #666;
  line-height: 22px;
  text-overflow: ellipsis;
  overflow: hidden;
}
.goods-des {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
}
.goods-title {
  margin-bottom: 5px;
  font-size: 16px;
  color: #333;
  line-height: 26px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bottom {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 12px;
  color: #999;
  align-self: flex-end;
}
</style>
